package com.fc.entities;

import java.text.SimpleDateFormat

import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.ManyToOne
import javax.persistence.Table
import javax.validation.constraints.NotNull

/**
 * 
 * @author aacs
 *
 */
@Entity
@Table(name = "FoodJournal")
class FoodJournal extends BaseEntity {
	@ManyToOne
	Recipe recipe = new Recipe()
	
	@Column(name = "quantity")
	int quantity

	@Column(name = "date")
	Date date = new Date()
	
	@ManyToOne
	@NotNull
	User user
	
	String getDateString() {
		return new SimpleDateFormat("yyyy.MM.dd").format(date)
	}
}
